package com.chengh.springboot.dynamicdatasource.controller;


import com.chengh.springboot.dynamicdatasource.annotation.DataSource;
import com.chengh.springboot.dynamicdatasource.pojo.User;
import com.chengh.springboot.dynamicdatasource.service.IUserService;
import com.chengh.springboot.dynamicdatasource.utils.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author chengh
 * @since 2021-10-28
 */
@Controller
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/add")
    public String add(@RequestBody User user) {
        log.info("获得参数【{}】",user);
        Boolean b = userService.addUser(user);
        return "添加成功";
    }

}
